### UP
[sched_setparam](##sched_setparam)
[MAIN](##MAIN)
[MAIN_ru](##MAIN_ru)
[ANCORS](##ANCORS)
[ISU](##ISU)
[inet](##A_inet)
[inet](##books_inet)
[inet](##examples_inet)
[inet](##classic_inet)
[inet](##enters_inet)
[inet](##issue_code_inet)
[H_FILE](##H_FILE)
[p_SYNOPSIS](##p_SYNOPSIS)
[p_RETURN](##p_RETURN)
[p_RETURN_ru](##p_RETURN_ru)
[p_BUGS](##p_BUGS)
[p_DESCRIPTION_ru](##p_DESCRIPTION_ru)
[p_DESCRIPTION](##p_DESCRIPTION)
[p_MIRRORS](##p_MIRRORS)
[p_EXAMPLES](##p_EXAMPLES)
[p_CODE_h](##p_CODE_h)
[p_CODE_c](##p_CODE_c)
[p_CODE_m](##p_CODE_m)
[p_ERRORS](##p_ERRORS)
[p_BOOKS](##p_BOOKS)
[p_BOOKS_ru](##p_BOOKS_ru)
[p_CONTENT](##p_CONTENT)

[cat_hfiles](../../cat_hfiles.md)
[cat_utils](../../cat_utils.md)
[cat_structs](../../cat_structs.md)
[cat_param](../../cat_params.md)
[cat_macros](../../cat_macross.md)
[cat_const](../../cat_consts.md)
[cat_type](../../cat_types.md)
[cat_any](../cat_anys.md)


[UP](###UP)
## MAIN
:sched_setparam:
[next](##MAIN_ru)

<<MAIN>>
[MAIN](../../fills/sched_setparam/MAIN)



[UP](###UP)
## MAIN_ru
:sched_setparam:
[next](##ANCORS)

----------------------------------------------------- 
-------------------------------------- 
получает и устанавливает параметры
-------------------------------------- 
----------------------------------------------------- 
<<MAIN_ru>>
[MAIN_ru](../../fills/sched_setparam/MAIN_ru)

[UP](###UP)
## ANCORS
:sched_setparam:
[next](##ISU)

----------------------------------------------------- 
-------------------------------------- 
http://osr507doc.xinuos.com/en/man/html.S/sched_setparam.S.html
https://yumichan.net/programming/obtain-a-list-of-process-scheduling-policy-and-priority/
-------------------------------------- 
----------------------------------------------------- 
<<ANCORS>>
[ANCORS](../../fills/sched_setparam/ANCORS)

[UP](###UP)
## ISU
:sched_setparam:
[next](##H_FILE)

----------------------------------------------------- 
-------------------------------------- 
file://${COMMUNIS_PATH}/Deploy_store/.qa/main_repo_fn/dir_c_/_c_/_man/nbase/_Head_sis_libs_posix/27_sched_h/6_sched_setparam/study_cpjs/sched_setparam.isu
-------------------------------------- 
----------------------------------------------------- 
<<ISU>>
only read
:sched_setparam:
[ISU](../../contents)
[next](##inet)


[UP](###UP)
## inet
:sched_setparam:
[next](##H_FILE)


[UP](###UP)
## A_inet
[manpages.org](https://www.google.ru/search?q=sched_setparam+site%3Ahttps%3A%2F%2Fmanpages.org)
[reposcope.com_ru](https://www.google.ru/search?q=sched_setparam+site%3Ahttps%3A%2F%2Freposcope.com%2Fmanpages%2Fru)
[pubs.opengroup.org](https://www.google.com/search?q=sched_setparam+https%3A%2F%2Fpubs.opengroup.org)
[manpages.debian.org](https://yandex.ru/search/?text=sched_setparam+site%3Ahttps%3A%2F%2Fmanpages.debian.org%2F)
[www.opennet.ru](http://www.opennet.ru/man.shtml?category=2&topic=sched_setparam)
[man7.org](https://www.google.ru/search?q=sched_setparam+site%3Ahttps%3A%2F%2Fman7.org%2Flinux%2Fman-pages)
[en.cppreference.com](https://www.google.com/search?q=sched_setparam+en.cppreference.com)
[www.mankier.com](https://www.mankier.com/?q=sched_setparam)
[www.codecogs.com](https://www.google.ru/search?q=sched_setparam+https%3A%2F%2Fwww.codecogs.com%2Flibrary%2Fcomputing%2F)
[digitalmars.com](https://www.google.ru/search?q=sched_setparam+https%3A%2F%2Fdigitalmars.com%2Frtl%2F)


[UP](###UP)
## books_inet
[cpp.com.ru](https://yandex.ru/search/?text=sched_setparam+site%3Ahttps%3A%2F%2Fcpp.com.ru)
[linuxhint.com](https://www.google.ru/search?q=sched_setparam+site%3Ahttps%3A%2F%2Flinuxhint.com)
[gnu.org](https://www.google.ru/search?q=sched_setparam+site%3Ahttps%3A%2F%2Fwww.gnu.org%2Fsoftware%2Flibc%2Fmanual)

[UP](###UP)
## examples_inet
[yandex:examples](https://yandex.ru/search/?text=sched_setparam+example+in+c)
[docs.oracle.com](https://www.google.com/search?q=sched_setparam+https%3A%2F%2Fdocs.oracle.com)
[manpages.debian.org](https://yandex.ru/search/?text=sched_setparam+site%3Ahttps%3A%2F%2Fmanpages.debian.org%2F)
[osr507doc.xinuos.com](https://www.google.com/search?q=sched_setparam+http%3A%2F%2Fosr507doc.xinuos.com%2Fen%2Fman)
[cpp.hotexamples.com](https://cpp.hotexamples.com/examples/-/-/sched_setparam/cpp-sched_setparam-function-examples.html)
[all-ht.ru](https://yandex.ru/search/?text=sched_setparam+site%3Ahttp%3A%2F%2Fall-ht.ru%2Finf%2Fprog%2Fc%2F)
[cppreference.com](https://yandex.ru/search/?text=sched_setparam+site%3Ahttps%3A%2F%2Fen.cppreference.com%2Fw%2Fc%2F)

[UP](###UP)
## classic_inet
[bogatyrev_c_unix](https://www.google.com/search?q=sched_setparam+site%3Ahttps%3A%2F%2Fcpp.com.ru%2Fbogatyrev_c_unix)
[kr_cbook](https://www.google.com/search?q=sched_setparam+site%3Ahttps%3A%2F%2Fcpp.com.ru%2Fkr_cbook)

[UP](###UP)
## enters_inet
[pubs.opengroup.org](https://pubs.opengroup.org/onlinepubs/9699919799/idx/head.html)

[UP](###UP)
## issue_code_inet
[code.woboq.org](https://www.google.com/search?h=&sitesearch=https%3A%2F%2Fcode.woboq.org%2Fuserspace%2Fglibc%2F&q=sched_setparam)


[UP](###UP)
## H_FILE 
[sched_h.md](../../hfiles/sched_h.md)


[UP](###UP)
## p_SYNOPSIS
:sched_setparam:
[next](##p_RETURN_ru)

----------------------------------------------------- 
-------------------------------------- 
#include <sched.h>
int sched_setparam(pid_t pid, const struct sched_param *param);
int sched_getparam(pid_t pid, struct sched_param *param);
struct sched_param {
...
int sched_priority;
...
};
-------------------------------------- 
----------------------------------------------------- 
<<SYNOPSIS>>
[SYNOPSIS](../../fills/sched_setparam/SYNOPSIS)


[UP](###UP)
## p_RETURN_ru
:sched_setparam:
[next](##p_RETURN)

<<RETURN>>
[RETURN_ru](../../fills/sched_setparam/RETURN)


[UP](###UP)
## p_RETURN
:sched_setparam:
[next](##p_DESCRIPTION_ru)

----------------------------------------------------- 
-------------------------------------- 
При успешном выполнении sched_setparam() и sched_getparam() возвращают 0. В случае ошибки возвращается -1, а errno устанавливается в соответствующее значение.
-------------------------------------- 
----------------------------------------------------- 
<<RETURN_ru>>
[RETURN](../../fills/sched_setparam/RETURN_ru)


[UP](###UP)
## p_DESCRIPTION_ru
:sched_setparam:
[next](##p_DESCRIPTION)

----------------------------------------------------- 
-------------------------------------- 
Вызов sched_setparam() устанавливает параметры планирования процесса с идентификатором pid в соответствии с его политикой планирования. Если pid равен нулю, то устанавливаются параметры вызывающего процесса. Тип и значение аргумента param зависит от политики планирования, назначенной процессу с идентификатором pid. Описание алгоритмов планирования, поддерживаемых в Linux, смотрите в sched(7).
Вызов sched_getparam() получает текущие параметры планирования процесса с pid. Если pid равен нулю, то возвращаются параметры вызывающего процесса.
Вызов sched_setparam() проверяет соответствие значения аргумента param политике планирования заданной нити. Значение param->sched_priority должно находиться в диапазоне от sched_get_priority_min(2) до sched_get_priority_max(2).
Описание привилегий и ограничений ресурсов, связанных с планирование и алгоритмами, смотрите в sched(7).
-------------------------------------- 
----------------------------------------------------- 
<<DESCRIPTION_ru>>
[DESCRIPTION_ru](../../fills/sched_setparam/DESCRIPTION_ru)


[UP](###UP)
## p_DESCRIPTION
:sched_setparam:
[next](##p_BUGS)

<<DESCRIPTION>>
[DESCRIPTION](../../fills/sched_setparam/DESCRIPTION)


[UP](###UP)
## p_MIRRORS
:sched_setparam:
[next](##p_BUGS)

<<MIRRORS>>
[MIRRORS](../../fills/sched_setparam/MIRRORS)


[UP](###UP)
## p_BUGS
:sched_setparam:
[next](##p_EXAMPLES)

<<BUGS>>
[BUGS](../../fills/sched_setparam/BUGS)


[UP](###UP)
## p_EXAMPLES
:sched_setparam:
[next](##p_CODE)

----------------------------------------------------- 
-------------------------------------- 
http://osr507doc.xinuos.com/en/man/html.S/sched_setparam.S.html
int pmin, pmax, priority = 36;
struct sched_param sp;
...
pmin = sched_get_priority_min(SCHED_FIFO);
pmax = sched_get_priority_max(SCHED_FIFO);
if (priority >= pmin && priority <= pmax) {
sp.sched_priority = priority;
}
else {
sp.sched_priority = pmin;
}
sched_setparam(0, &sp);
https://yumichan.net/programming/obtain-a-list-of-process-scheduling-policy-and-priority/
/* Includes */
#include <stdio.h>
#include <sched.h>
/* Functions */
int main() {
int ret;
int numOfProcess = 31;
const pid_t pid[] = { 1, 2, 3, 4, 5, 6, 7, 8, 138, 140, 
141, 143, 156, 169, 170, 252, 255, 309, 317, 325, 
399, 404, 409, 412, 415, 418, 460, 469, 487, 500,
505 }; // an array of pids, change to the list you want
int i = 0;
struct sched_param stSched = { 0 };
for ( ; i < numOfProcess; ++i) {
ret = sched_getscheduler(pid[i]); // get the policy
if (ret < 0) {
printf("Error: sched_getscheduler
");
goto ERR_STATE;
}
printf("pid %d Policy: %d ", pid[i], ret);
switch (ret) {
case SCHED_OTHER: // the default policy, use SCHED_NORMAL instead of SCHED_OTHER sometimes
printf("SCHED_OTHER	");
break;
case SCHED_FIFO:
printf("SCHED_FIFO	");
break;
case SCHED_RR:
printf("SCHED_RR	");
break;
/*case SCHED_BATCH: // uncomment this case if your Linux support it
printf("SCHED_BATCH
");
break;
case SCHED_IDLE: // uncomment this case if your Linux support it
printf("SCHED_IDLE
");
break;*/
default:
printf("No matching schedule policy!
");
break;
};
ret = sched_getparam(pid[i], &stSched); // get the priority
if (ret != 0) {
printf("Error: sched_getparam
");
goto ERR_STATE;
}
printf("Priority: %d
", stSched.sched_priority);
memset(&stSched, 0, sizeof(struct sched_param));
}
ERR_STATE:
return 0;
}
-------------------------------------- 
----------------------------------------------------- 
<<EXAMPLES>>
[EXAMPLES](../../fills/sched_setparam/EXAMPLES)


[UP](###UP)
## p_CODE_h
:sched_setparam:
[next](##p_CODE_c)

----------------------------------------------------- 
-------------------------------------- 
https://code.woboq.org/userspace/glibc/posix/sched.h.html
-------------------------------------- 
----------------------------------------------------- 
<<CODE_h>>
[CODE_h](../../fills/sched_setparam/CODE_h)


[UP](###UP)
## p_CODE_c
:sched_setparam:
[next](##p_CODE_m)

----------------------------------------------------- 
-------------------------------------- 
https://code.woboq.org/userspace/glibc/posix/sched_setp.c.html
#include <errno.h>
#include <sys/types.h>
#include <sched.h>
/* Set scheduling parameters for a process.  */
int
__sched_setparam (pid_t pid, const struct sched_param *param)
{
__set_errno (ENOSYS);
return -1;
}
stub_warning (sched_setparam)
libc_hidden_def (__sched_setparam)
weak_alias (__sched_setparam, sched_setparam)
-------------------------------------- 
----------------------------------------------------- 
<<CODE_c>>
[CODE_c](../../fills/sched_setparam/CODE_c)


[UP](###UP)
## p_CODE_m
:sched_setparam:
[next](##p_ERRORS)

<<CODE_m>>
[CODE_m](../../fills/sched_setparam/CODE_m)


[UP](###UP)
## p_ERRORS
:sched_setparam:
[next](##p_BOOKS)

<<ERRORS>>
[ERRORS](../../fills/sched_setparam/ERRORS)


[UP](###UP)
## p_BOOKS
:sched_setparam:
[next](##p_BOOKS_ru)

<<BOOKS>>
[BOOKS](../../fills/sched_setparam/BOOKS)


[UP](###UP)
## p_BOOKS_ru
:sched_setparam:
[next](##p_CONTENT)


<<BOOKS_ru>>
[BOOKS_ru](../../fills/sched_setparam/BOOKS_ru)


[UP](###UP)
## p_CONTENT
:sched_setparam:
[sched_setparam.cnt](../../contents/sched_setparam.cnt)
[next](##UP)

[UP](###UP)